<template>
	<div class="div_bg">
	<div class="login_box">
		<div class="form_login">
			<ul class="login_ul">
				<li class="login_li">
					<input type="number" v-model="shoujihao" placeholder="请输入手机号" />
				</li>
				<li class="login_li">
					<input type="password" v-model="password" placeholder="请输入登录密码" />
				</li>
			</ul>
			<input type="button" class="submit_btn" @click="login" value="登录" />
			<div class="lianjie_div">
				<router-link tag="span" to="register">立即注册</router-link>
				<router-link tag="span" to="wangjimima">忘记密码</router-link>
			</div>
		</div>
	</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				shoujihao: '',//手机号
				password: ''//密码
			}
		},
		methods: {
			async login(){
				if(!this.shoujihao||!this.password){
					this.$toast("请输入完善信息");
					return
				}
					let res=await this.http.post("/api/login",{
						mobile:this.shoujihao,
						pwd:this.password
					});
					if (res.status_code==200) {
						localStorage.setItem("token",res.data.token);
						this.$toast("登录成功");
						this.$store.commit('setToken',res.data.token)
						this.$router.replace({path:'/wuxingfushi'});
					}
			},

		},

	}
</script>

<style scoped>
	@import url("../../../assets/css/ttcp/login.css");

</style>
